import time,asyncio,functools

def three():
    start=time.time()
    async def corowork():
        print('[corowork]Start coroutine')
        time.sleep(0.1)
        print('[corowork]This is a coroutine')
    def callback(name,task):
        print(f'[callback]Hello {name}')
        print(f'[callback]coroutine state:{task._state}')
    loop=asyncio.new_event_loop()
    coroutine=corowork()
    task=loop.create_task(coroutine)
    task.add_done_callback(functools.partial(callback,'World'))
    loop.run_until_complete(task)
    end=time.time()
    print('Running time:{:.4f}'.format(end-start))

three()
